package oop6;

import oop5.Cat;
import oop5.Dog;
import oop5.Pet;

/**
 * @author oldliu
 * @since 1.0
 */
public class PetDoctor {
    private String name;

    public PetDoctor(String name) {
        this.name = name;
    }

    //治疗
    public void cure(Pet c) {
        c.print();
        //如果是老虎，把嘴捆起来
        if (c instanceof Tiger) {
            System.out.println("这是一只猛兽，把嘴捆起来");
        }
        //>>>假如这个宠物是鹦鹉，让他飞行一下看看健康情况
        if (c instanceof Parrot) {
            Parrot x = (Parrot) c;
            x.fly();
        }
        System.out.println(name + "在给" + c.getName() + "检查");
        while (c.getHealth() < 60) {
            System.out.println("打针吃药");
            System.out.println("慢慢恢复了");
            c.setHealth(c.getHealth() + 3);
        }
        System.out.println("你没病，走两步");
    }

    public void cure(Student s) {
        System.out.println("兽医" + name + "给人" + s.getName() + "治疗");
    }

//    public void cure(Cat c) {
//        System.out.println(name + "在给" + c.getName() + "检查");
//        if (c.getHealth() < 60) {
//            System.out.println("打针吃药");
//            System.out.println("慢慢恢复了");
//            c.setHealth(80);
//            return;
//        }
//        System.out.println("你没病，走两步");
//    }
//
//    public void cure(Dog c) {
//        System.out.println(name + "在给" + c.getName() + "检查");
//        if (c.getHealth() < 60) {
//            System.out.println("打针吃药");
//            System.out.println("慢慢恢复了");
//            c.setHealth(80);
//            return;
//        }
//        System.out.println("你没病，走两步");
//    }
//
//    public void cure(Parrot c) {
//        System.out.println(name + "在给" + c.getName() + "检查");
//        if (c.getHealth() < 60) {
//            System.out.println("打针吃药");
//            System.out.println("慢慢恢复了");
//            c.setHealth(80);
//            return;
//        }
//        System.out.println("你没病，走两步");
//    }
}
